version: '3.8'
services:
  gateway:
    build:
      context: gateway
    container_name: gateway
    ports:
      - "8080:8080"
    depends_on:
      - server
    environment:
      - SHAREIT_SERVER_URL=http://server:9090

  server:
    build:
      context: server
    container_name: server
    ports:
      - "9090:9090"
    depends_on:
      - db
    environment:
      - DB_NAME=shareit
      - DB_HOST=db
      - DB_PORT=5432
      - POSTGRES_USER=shareit
      - POSTGRES_PASSWORD=shareit
    restart: on-failure

  db:
    image: postgres:13.7-alpine
    container_name: db
    volumes:
      - /var/lib/postgresql/data/
    ports:
      - "6541:5432"
    environment:
      - POSTGRES_DB=shareit
      - POSTGRES_USER=shareit
      - POSTGRES_PASSWORD=shareit
